
package lecho.lib.hellocharts.pdf;

import java.io.IOException;

import com.itextpdf.text.*;

public class PrintPDF {
	public  static double[] line_scale  = new double[]{0.25, 0.5,  0.75,  1.0,   1.25,  1.5,   1.75,  2.0,   2.25,  2.5,   2.75,  3.0};
	public  static double[] line_peach  = new double[]{2.11, 3.65, 4.69,  5.61,  6.34,  7.04,  7.72,  8.36,  9.09,  9.68,  10.27, 11.07};
	public  static double[] line_orange = new double[]{3.10, 5.46, 6.78,  8.14,  9.35,  10.34, 11.44, 12.39, 13.51, 15.54, 15.55, 16.63};
	public  static double[] line_green  = new double[]{3.63, 6.14, 7.83,  9.35,  10.56, 11.66, 12.78, 13.79, 15.00, 15.97, 16.98, 18.26};
	public  static double[] line_blue   = new double[]{4.20, 7.02, 8.76,  10.34, 11.75, 12.96, 14.08, 15.16, 16.61, 17.49, 18.59, 19.73};
	public  static double[] line_plum   = new double[]{4.53, 7.59, 9.79,  11.75, 13.29, 14.89, 16.48, 17.91, 19.69, 21.03, 22.53, 24.29};
	public  static double[] line_gray   = new double[]{5.39, 8.84, 11.29, 13.62, 15.49, 17.05, 18.85, 20.39, 22.44, 23.80, 25,43, 27.24};

	public static void main(String[] args) {

		System.out.println("Hello World");

		Font catFont = new Font(Font.FontFamily.TIMES_ROMAN, 18,
				Font.BOLD);
		Font redFont = new Font(Font.FontFamily.TIMES_ROMAN, 12,
				Font.NORMAL, BaseColor.RED);
		Font subFont = new Font(Font.FontFamily.TIMES_ROMAN, 16,
				Font.BOLD);
		Font smallBold = new Font(Font.FontFamily.TIMES_ROMAN, 12,
				Font.BOLD);

		for (int i=0; i<12; i++){
			System.out.println("line_scale--" + (float)line_scale[i]);
		}
		System.out.println("line_scale--" + (float)1.75);
		System.out.println("line_scale--" + (float)(line_scale[6]));

		PdfItextUtil pdfItextUtil = null;
		try {
			// step 2:
			// we create a writer that listens to the document
			// and directs a PDF-stream to a file


//			Font red = FontFactory.getFont(FontFactory.HELVETICA, Font.DEFAULTSIZE, Font.BOLD, new Color(0xFF, 0x00, 0x00));
//			Font blue = FontFactory.getFont(FontFactory.HELVETICA, Font.DEFAULTSIZE, Font.ITALIC, new Color(0x00, 0x00, 0xFF));
//			Paragraph p;
//			p = new Paragraph("");
//			p.add(new Chunk("Trend", red));
//			document.add(p);
//			document.add(new Paragraph("............................\n\n"));




			pdfItextUtil = new PdfItextUtil("test/hello.pdf")
					.addTitleToPdf("弹力带康复机-测试报告")
					.addTextToPdf("测试内容一，发的打发士大夫发生的尽快发链接撒旦看风景啊的会计分录发动反对坷拉激发离开")
					.addImageToPdfCenterH("test/image/hitchcock.png",160,160)
					.addTextToPdf("fdsajfasjdflkjsdakfjsdkfjsakdfjkdsafjskadfjksdjfklasdjflksajflkasdjflkdajskfjasjkldff");


		} catch (DocumentException de) {
			System.err.println(de.getMessage());
		} catch (IOException ioe) {
			System.err.println(ioe.getMessage());
		} finally {
		if (pdfItextUtil != null)
			pdfItextUtil.close();
	}

	}
}